package com.wutianyi.web.wrapper;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpSession;


import com.wutianyi.session.SessionFactory;

public class SessionHttpServletRequest extends HttpServletRequestWrapper {

	private SessionFactory sessionFactory;
	private String sessionId;

	public SessionHttpServletRequest(HttpServletRequest request,
			SessionFactory sessionFactory, String sessionId) {
		super(request);
		this.sessionFactory = sessionFactory;
		this.sessionId = sessionId;
	}

	@Override
	public HttpSession getSession(boolean create) {
		return sessionFactory.getHttpSession(sessionId);
	}
	@Override
	public HttpSession getSession() {
		return getSession(false);
	}

}
